'''
    对数几率回归（逻辑回归）
    将输入特征转为0或1的概率并进行分类
'''

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split,cross_val_predict
from sklearn.linear_model import LinearRegression
from sklearn import metrics
from sklearn import datasets
from sklearn.preprocessing import StandardScaler

iris=datasets.load_iris()
x=np.array(iris.data)[:,[2,3]]
y=np.array(iris.target)
x_train,x_test,y_train,y_test=train_test_split(x,y,random_state=1)

# 标准化 将特征数据的分布调整为高斯分布 标准化后数据均值为0 方差为1（接近）
sc=StandardScaler()
sc.fit(x_train)
x_train_std=sc.transform(x_train)
x_test_std=sc.transform(x_test)
#print(x_test_std.std())
x_combine_std=np.vstack((x_train_std,x_test_std))
print(x_train_std)
print(x_test_std)
print(x_combine_std)

